<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>字典表编辑</title>

<%@include file="/WEB-INF/pages/common/head.jsp" %>

<style type="text/css">
/* error message */
.error {
    /* supply height to ensure consistent positioning for every browser */
    height:15px;
    background-color:#FFFE36;
    border:1px solid #E1E16D;
    font-size:11px;
    color:#000;
    padding:3px 10px;
    margin-left:-2px;


    /* CSS3 spicing for mozilla and webkit */
    -moz-border-radius:4px;
    -webkit-border-radius:4px;
    -moz-border-radius-bottomleft:0;
    -moz-border-radius-topleft:0;
    -webkit-border-bottom-left-radius:0;
    -webkit-border-top-left-radius:0;

    -moz-box-shadow:0 0 6px #ddd;
    -webkit-box-shadow:0 0 6px #ddd;
}
</style>

<script type="text/javascript" src="<%=root%>/plugin/jquery_tools/validator.js"></script>

<link rel="stylesheet" type="text/css" href="<%=root%>/plugin/flexigrid/css/flexigrid/flexigrid.css">
<script type="text/javascript" src="<%=root%>/plugin/flexigrid/flexiform.js"></script>
<script type="text/javascript">

/*
function doAdd() {
    top.$.post("/easyframe/system/dict_create.action", top.$(editForm).serialize(), doAddOnRetrun); 
}

function doAddOnRetrun(xml) {
    doList();
    
    $('#dialogEdit').dialog("close");
}

function getDict() {
    var params = {isSearch:true, onReturn:getDictOnReturn} ;
    
    openWindow("dictList", "查找Dict", "/easyframe/html/system/dict/list.html", params, null, 910, 760) ;
}

function getDictOnReturn(retValue) {
    e_('dict.domain_').value = retValue ;
}*/


function getDict() {
    //var params = {isSearch:true, onReturn:getDictOnReturn} ;
    
    openWindow({url:"<%=root%>/system/dict_grid.action", name:"dictSearchWindow", width:860, height:560}) ;
}

window.onload = function() {
    top.$('.pReload').removeClass('loading');
    if (window.name == "updateDict") {
        opener.dataGrid.fillEditForm(editForm) ;
        editForm.action = "<%=root%>/system/dict_update.action" ;
    } else {
        editForm.action = "<%=root%>/system/dict_create.action" ;
    }

    $('#formTable').flexigrid(

            {
                buttons : [{name :'添加',bclass:'add',onpress:doSave}],
                usepager: false,
                title: '测试表单',
                useRp: false,
                showTableToggleBtn: false,
                height:"auto",
                minwidth:500,
                singleSelect:true,
                multisel:false
            }
     );

    $("#editForm").validator();
}

function doSave() {
	
    //top.$.post(editForm.action, top.$(editForm).serialize(), doSaveOnRetrun); 
}

var isSaved = false ;
function doSaveOnRetrun(xml) {
	isSaved = true ;
}

window.onunload = function () {

    
    if (isSaved && isDefined(opener.formWindowOnClose)) {
    	opener.formWindowOnClose(editForm) ;
    }

    unblock();
}

function gridWindowOnSelected(rowData) {
	editForm['dict.domain_'].value = xml2Object(rowData).domain_.innerText;
}
</script>
</head>
<body topmargin="0" leftmargin="0">
<div class=".pReloa"></div>
  <form action="" method="post" name="editForm" id="editForm">
      <input type="hidden" name="dict.dict_id"/>
      <table id="formTable" height="100%" width="100%">
        <tbody>
          <tr width="200"><td>domain_:</td></tr>
          <tr><td><input type="text" name="dict.domain_" required="required"/><input type="button" value="getDict" onclick="getDict()" /></td></tr>
          <tr><td>code:</td></tr>
          <tr><td><input type="text" name="dict.code_"  required="required"/></td></tr>
          <tr><td>name:</td></tr>
          <tr><td><input type="text" name="dict.name_"/></td></tr>
          <tr>
            <td>
              <input type="button" name="save" value="save" onclick="doSave()"/>
              &nbsp;&nbsp;
              <input type="button" name="close" value="close" onclick="window.close()"/>
              <input type="submit" name="submit"/>
            </td>
          </tr>
        </tbody>
      </table>
  </form>
</body>
</html>